#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

   socket = new QTcpSocket(this);
     connect(socket,SIGNAL(connected()),this,SLOT(connectedSlot()));
}

MainWindow::~MainWindow()
{
    delete ui;
}



void MainWindow::on_sendMsgBtn_clicked()
{
    socket->connectToHost(QHostAddress("192.168.0.161"), 9999);  //此处是以板子为服务器  这里是板子的地址。需要和windowPC处于同一网段
    QString contactsOne = ui->textPeople_one->text();
    QString contactsTwo = ui->textPeople_two->text();
  //  strArray.append(contactsOne);
    //strArray.append(contactsTwo);

    QByteArray arr;
    arr.append(contactsOne);
    arr.append(" ");
    arr.append(contactsTwo);
    arr.append(" ");
    qint64 ret = socket->write(arr);

    if(ret > 0)
    {
        qDebug() << "发送成功!";
    }
}
void MainWindow::on_candleBtn_clicked()
{

}
